package org.yly.game.rpggame.domain.model;

import java.util.Collection;

public class PropertyUtils {

	/**
	 * 两组属性相加,把第二组属性加到第一组属性值上
	 * @param customProperty1
	 * @param customProperty2
	 */
	public static void add(Collection<CustomProperty> customProperty1, Collection<CustomProperty> customProperty2) {
		for (CustomProperty property1 : customProperty1) {
			for (CustomProperty property2 : customProperty2) {
				if (property1.equalsName(property2)) {
					property1.add(property2);
				}
			}
		}		
	}
	
	/**
	 * 两组属性相加,从第一组属性值里减去第二组属性值
	 * @param customProperty1
	 * @param customProperty2
	 */
	public static void sub(Collection<CustomProperty> customProperty1, Collection<CustomProperty> customProperty2) {
		for (CustomProperty property1 : customProperty1) {
			for (CustomProperty property2 : customProperty2) {
				if (property1.equalsName(property2)) {
					property1.sub(property2);
				}
			}
		}		
	}
}
